//
//  StatusCollectionViewCell.m
//  BMS
//
//  Created by 颜魏 on 2024/12/9.
//

#import "StatusCollectionViewCell.h"

@interface StatusCollectionViewCell()

@property (weak, nonatomic) IBOutlet UIView *bgView;
@property (weak, nonatomic) IBOutlet UIImageView *iconIV;
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *topSpac;

@end

@implementation StatusCollectionViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.bgView.layer.masksToBounds = YES;
    self.bgView.layer.cornerRadius = 6;
}

- (void)setIconImage:(NSString *)iconImage {
    _iconImage = iconImage;
    self.iconIV.image = [UIImage imageNamed:iconImage];
}

- (void)setTitle:(NSString *)title {
    _title = title;
    self.titleLabel.text = title;
}

- (void)setIsStandby:(BOOL)isStandby {
    _isStandby = isStandby;
    self.titleLabel.textColor = isStandby ? [UIColor whiteColor] : [UIColor lightGrayColor];
    self.bgView.backgroundColor = isStandby ? SUBJECT_COLOR : RGBCOLOR(240, 240, 240);
}

- (void)setIndex:(NSInteger)index {
    _index = index;
    self.topSpac.constant = _index < 4 ? 15 : 5;
}

@end
